
package com.ukao.cashregister.pesenter;

import android.content.Context;

import com.ukao.cashregister.base.BasePresenter;
import com.ukao.cashregister.bean.StringBean;
import com.ukao.cashregister.consts.Constant;
import com.ukao.cashregister.consts.SaveParamets;
import com.ukao.cashregister.retrofit.ApiCallback;
import com.ukao.cashregister.view.VipDetailsTabView;

import java.util.HashMap;

/**
 * Created by ukaodev on 2017/6/28.
 */

public class VipDetailsTabPesenter extends BasePresenter<VipDetailsTabView> {
    private boolean isloaderr;

    public VipDetailsTabPesenter(VipDetailsTabView view) {
        attachView(view);
    }





    /*现金充值*/
    public void confirmRecharge(Context mContext,String userId,String amount  ) {
        mvpView.showLoading();
        HashMap mHashMap = new HashMap<String, String>();
        mHashMap.put("userId",userId);
        mHashMap.put("amount", amount);
        mHashMap.put("accessToken", SaveParamets.getToken(mContext));
        addSubscription(apiStores.confirmRecharge(Constant.createParameter(mHashMap)),
                new ApiCallback<StringBean>() {
                    @Override
                    public void onSuccess(StringBean model) {
                        if (model.getHttpCode() == 200) {

                            mvpView.rechargeSucceed(model.getMsg());
                        }else{
                            mvpView.loadFault(model.getMsg());
                        }

                    }


                    @Override
                    public void onFinish() {
                        mvpView.hideLoading();


                    }
                });
    }



}
